package demo4;

/**
 * Author：毕龙
 * Date: 2024/5/17 10:07
 */
public class TestString11 {
    public static void main(String[] args) {


        StringBuffer sb = new StringBuffer();
        long t1 = System.currentTimeMillis();
        for (int i = 0; i < 10000; i++) {
            sb.append(i);
        }
        long t2 = System.currentTimeMillis();
        System.out.println(t2-t1);

        StringBuilder sb1 = new StringBuilder();
        long t3 = System.currentTimeMillis();
        for (int i = 0; i < 10000; i++) {
            sb1.append(i);
        }
        long t4 = System.currentTimeMillis();
        System.out.println(t4-t3);

    }
}
